﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XProject.DataVisit.Factory;

namespace XProject.DataVisit.Model.Flow
{
    public class FlowName:IProjectModel
    {
        public virtual Guid PID { get; set; }
        /// <summary>
        /// 流程名称
        /// </summary>
        public virtual string FlowN { get; set; }
        /// <summary>
        /// 发布人
        /// </summary>
        public virtual Guid Creater { get; set; }

        public virtual DateTime LastUpdate { get; set; }

        public virtual string NTime
        {
            get
            {
                return LastUpdate.ToString("yyyy-MM-dd");
            }
        }

        public virtual UserInfo CreateName
        {
            get
            {
                if (Creater != Guid.Empty)
                    return DaoFactory.UserInfoDao.GetById(Creater);
                return null;
            }
        }

        #region 重写Hash和Equals
        public override int GetHashCode()
        {
            return PID.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            var temp = obj as FlowName;
            if (temp == null) return false;
            return temp.PID == this.PID;
        }
        #endregion
    }
}
